﻿<UserControl
    x:Class="yavc.Metro.Controls.PlayControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:yavc.Metro.Controls"
    xmlns:conv="using:yavc.Metro.Converters"
    x:Name="pc" Foreground="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource foregroundIsEnabledBrushConv}}">
    <UserControl.Resources>
        <conv:VisibilityBooleanConverter x:Key="visConv"
                                         DefaultVisibility="Collapsed"
                                         TrueVisibility="Visible"
                                         FalseVisibility="Collapsed" />
    </UserControl.Resources>
    <StackPanel Orientation="Vertical" DataContext="{Binding SelectedZone.Playback}">
        
        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4"
                   FontSize="{Binding ElementName=pc, Path=FontSize}"
                   Foreground="{StaticResource MetroAccentBrush}"
                   Text="{Binding PlaybackString}" />

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Margin" Value="8,2" />
                    <Setter Property="BorderBrush" Value="Transparent" />
                </Style>
            </StackPanel.Resources>

            <Button x:Name="prevBtn" Visibility="{Binding CanPrevious, Converter={StaticResource visConv}}" Click="prevBtn_Click">
                <Canvas Width="48" Height="48" UseLayoutRounding="False">
                    <Path Width="47" Height="47" Canvas.Left="0.499997" Canvas.Top="0.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 24,0.5C 36.9787,0.5 47.5,11.0213 47.5,24C 47.5,36.9787 36.9787,47.5 24,47.5C 11.0213,47.5 0.499997,36.9787 0.499997,24C 0.499997,11.0213 11.0213,0.5 24,0.5 Z M 24,3.5C 12.6782,3.5 3.5,12.6782 3.5,24C 3.5,35.3218 12.6782,44.5 24,44.5C 35.3218,44.5 44.5,35.3218 44.5,24C 44.5,12.6782 35.3218,3.5 24,3.5 Z "/>
                    <Path Width="24" Height="13" Canvas.Left="12" Canvas.Top="17.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 36,17.5L 36,30.5L 27.5,24L 36,17.5 Z M 25,17.5L 25,30.5L 16.5,24L 25,17.5 Z M 15,18L 15,30L 12,30L 12,18L 15,18 Z "/>
                </Canvas>
            </Button>
            <Button x:Name="stopBtn" Visibility="{Binding CanStop, Converter={StaticResource visConv}}" Click="stopBtn_Click">
                <Canvas Width="48" Height="48" UseLayoutRounding="False">
                    <Path Width="47" Height="47" Canvas.Left="0.499997" Canvas.Top="0.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 24,0.5C 36.9787,0.5 47.5,11.0213 47.5,24C 47.5,36.9787 36.9787,47.5 24,47.5C 11.0213,47.5 0.499997,36.9787 0.499997,24C 0.499997,11.0213 11.0213,0.5 24,0.5 Z M 24,3.5C 12.6782,3.5 3.5,12.6782 3.5,24C 3.5,35.3218 12.6782,44.5 24,44.5C 35.3218,44.5 44.5,35.3218 44.5,24C 44.5,12.6782 35.3218,3.5 24,3.5 Z "/>
                    <Rectangle Width="18" Height="18" Canvas.Left="15" Canvas.Top="15" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}"/>
                </Canvas>
            </Button>
            <Button x:Name="playBtn" Visibility="{Binding CanPlay, Converter={StaticResource visConv}}" Click="playBtn_Click">
                <Canvas Width="48" Height="48" UseLayoutRounding="False">
                    <Path Width="47" Height="47" Canvas.Left="0.499997" Canvas.Top="0.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 24,0.5C 36.9787,0.5 47.5,11.0213 47.5,24C 47.5,36.9787 36.9787,47.5 24,47.5C 11.0213,47.5 0.499997,36.9787 0.499997,24C 0.499997,11.0213 11.0213,0.5 24,0.5 Z M 24,3.5C 12.6782,3.5 3.5,12.6782 3.5,24C 3.5,35.3218 12.6782,44.5 24,44.5C 35.3218,44.5 44.5,35.3218 44.5,24C 44.5,12.6782 35.3218,3.5 24,3.5 Z "/>
                    <Path Width="12.9999" Height="20" Canvas.Left="19" Canvas.Top="14" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 19,14L 31.9999,23.7501L 31.9999,24.5001L 19,34L 19,14 Z "/>
                </Canvas>
            </Button>
            <Button x:Name="pauseBtn" Visibility="{Binding CanPause, Converter={StaticResource visConv}}" Click="pauseBtn_Click">
                <Canvas Width="48" Height="48" UseLayoutRounding="False">
                    <Path Width="47" Height="47" Canvas.Left="0.499997" Canvas.Top="0.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 24,0.5C 36.9787,0.5 47.5,11.0213 47.5,24C 47.5,36.9787 36.9787,47.5 24,47.5C 11.0213,47.5 0.499997,36.9787 0.499997,24C 0.499997,11.0213 11.0213,0.5 24,0.5 Z M 24,3.5C 12.6782,3.5 3.5,12.6782 3.5,24C 3.5,35.3218 12.6782,44.5 24,44.5C 35.3218,44.5 44.5,35.3218 44.5,24C 44.5,12.6782 35.3218,3.5 24,3.5 Z "/>
                    <Path Width="14" Height="18" Canvas.Left="17" Canvas.Top="15" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 17,15L 21,15L 21,33L 17,33L 17,15 Z M 27,15L 31,15L 31,33L 27,33L 27,15 Z "/>
                </Canvas>
            </Button>
            <Button x:Name="nextBtn" Visibility="{Binding CanNext, Converter={StaticResource visConv}}" Click="nextBtn_Click">
                <Canvas Width="48" Height="48" UseLayoutRounding="False">
                    <Path Width="47" Height="47" Canvas.Left="0.499997" Canvas.Top="0.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 24,0.5C 36.9787,0.5 47.5,11.0213 47.5,24C 47.5,36.9787 36.9787,47.5 24,47.5C 11.0213,47.5 0.499997,36.9787 0.499997,24C 0.499997,11.0213 11.0213,0.5 24,0.5 Z M 24,3.5C 12.6782,3.5 3.5,12.6782 3.5,24C 3.5,35.3218 12.6782,44.5 24,44.5C 35.3218,44.5 44.5,35.3218 44.5,24C 44.5,12.6782 35.3218,3.5 24,3.5 Z "/>
                    <Path Width="24" Height="13" Canvas.Left="12" Canvas.Top="17.5" Stretch="Fill" Fill="{Binding ElementName=pc, Path=Foreground}" Data="F1 M 12,17.5L 20.5,24L 12,30.5L 12,17.5 Z M 23,17.5L 31.5,24L 23,30.5L 23,17.5 Z M 33,18L 36,18L 36,30L 33,30L 33,18 Z "/>
                </Canvas>
            </Button>
        </StackPanel>
    </StackPanel>
</UserControl>
